/**
 * @projectName CollegeEmploymentNetwork
 * @package com.kzj.CollegeEmploymentNetwork.shiro
 * @className com.kzj.CollegeEmploymentNetwork.shiro.overrides.SecretFreeAbleCredentialsMatcher
 * @copyright Copyright 2025 Thunisoft, Inc All rights reserved.
 */
package com.kzj.CollegeEmploymentNetwork.shiro.overrides;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;

/**
 * SecretFreeAbleCredentialsMatcher
 * @description
 * @author KZJ
 * @date 2025/1/24 19:40
 * @version TODO
 */
public class SecretFreeAbleCredentialsMatcher extends HashedCredentialsMatcher {
    @Override
    public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
        if(info instanceof SecretFreeAbleAuthenticationToken){
            SecretFreeAbleAuthenticationToken freeInfo=(SecretFreeAbleAuthenticationToken) info;
            if(freeInfo.isFree())
                return true;
        }
        return super.doCredentialsMatch(token, info);
    }
}